<?php
	require_once("../classes/Database.php");
	
	session_start();
	
	if(isset($_SESSION["postRemove"])){
		$id = $_SESSION["postRemove"];
		$ad = $_SESSION["ad"];
		unset($_SESSION["ad"]);
		unset($_SESSION["postRemove"]);
		
		$db = new Database("localhost", "root", "");
		$db->connect("emprego");
		$db->executeQuery("DELETE FROM posts WHERE id=$id");
		$db->disconnect();
	}
	
	header("Location: ../announcement.php?ad=".$ad);
?>